//
//  CinemaTableViewCell.m
//  豆瓣
//
//  Created by aaaaaa on 16/6/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CinemaTableViewCell.h"
#import "CinemaModel.h"
#import "Tools.h"

@interface CinemaTableViewCell ()

@property (nonatomic, retain) UIImageView *blueBackgroundImageView; //蓝背景
@property (nonatomic, retain) UILabel *titleLable; //标题Lable
@property (nonatomic, retain) UILabel *addressLable; //地址
@property (nonatomic ,retain) UILabel *phoneLable; //电话

@end

@implementation CinemaTableViewCell

- (void)dealloc
{
    [_cinemaModel release];
    [_blueBackgroundImageView release];
    [_titleLable release];
    [_addressLable release];
    [_phoneLable release];
    [super dealloc];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}


- (void)createSubViews{
    
    self.blueBackgroundImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_blueBackgroundImageView];
    [_blueBackgroundImageView release];
    
    self.titleLable = [[UILabel alloc] init];
    [self.blueBackgroundImageView addSubview:_titleLable];
    [_titleLable release];
    self.titleLable.font = [UIFont systemFontOfSize:26];
    
    self.addressLable = [[UILabel alloc] init];
    [self.blueBackgroundImageView addSubview:_addressLable];
    [_addressLable release];
    
    
    
    self.phoneLable = [[UILabel alloc] init];
    [self.blueBackgroundImageView addSubview:_phoneLable];
    [_phoneLable release];
   
    
    
}


- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.blueBackgroundImageView.image = IMAGE(@"bg_eventlistcell", @"png");
    self.blueBackgroundImageView.frame = CGRectMake(10, 10, self.contentView.bounds.size.width - 20 , self.contentView.bounds.size.height - 20);
    
    self.titleLable.frame = CGRectMake(10, 5, self.contentView.bounds.size.width - 40, 30);
    self.titleLable.text = self.cinemaModel.cinemaName;
    
    CGFloat addressHeight = [Tools getTextHeight:self.cinemaModel.address withWidth:self.contentView.bounds.size.width - 40 withFontSize:16];
    self.addressLable.frame = CGRectMake(10, (self.contentView.bounds.size.height - addressHeight - 20) / 2, self.contentView.bounds.size.width - 40, addressHeight);
    self.addressLable.text = self.cinemaModel.address;
    self.addressLable.numberOfLines = 0;
    self.addressLable.font = FONT;
    
    self.phoneLable.frame = CGRectMake(10, self.contentView.bounds.size.height - 50 , self.contentView.bounds.size.width - 40, 20);
    self.phoneLable.text = self.cinemaModel.telephone;
    self.phoneLable.font = FONT;
}

- (void)setCinemaModel:(CinemaModel *)cinemaModel{
    if (_cinemaModel != cinemaModel) {
        [_cinemaModel release];
        _cinemaModel = [cinemaModel retain];
    }
    
    
    
    
}









@end
